﻿DBSystem.clientesList = (function () {

    var viewModel = kendo.observable({
        clientesDataSource: {},
        criterio: "",
        buscar: function (e) {
            onShow();
        },

        registrar: function (e) {
            DBSystem.main.getApplication().navigate("#registrarClienteView");
        }


    });

    function onShow() {
        var criterio = viewModel.get("criterio");

        $.ajax({
            url: DBSystem.config.urlServiceClientes + "?criterio=" + criterio,
            dataType: "json",
            success: function (data) {
                viewModel.set("clientesDataSource", data);
            }
        });

    }

    return {
        onShow: onShow,
        viewModel: viewModel
    };

})(window)